package com.stu.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wzm
 * @create 2023-03-01 10:15
 */
@Configuration
public class MPConfig {

    //返回一个普通对象给SpringBoot管理
    @Bean
    public MybatisPlusInterceptor getMpConfig(){
        /*创建一个mp拦截器*/
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //添加mp分页拦截器到对象中
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }
}
